<template>
  <el-dialog title="导入Excel" :visible.sync="dialogFormVisible" :close-on-click-modal='false' center append-to-body>
    <el-button class="miui-dialog-close-btn" @click="dialogFormVisible = false">关闭页面</el-button>
    <el-upload
      class="upload-demo"
      action="/pvm/pvmmedicalreport/upload"
      :headers="headers"
      :data="uploadParams"
      :before-upload="beforeUpload"
      :on-preview="handlePreview"
      :on-remove="handleRemove"
      :before-remove="beforeRemove"
      multiple
      :file-list="fileList">
      <el-button size="small" type="primary">点击上传</el-button>
    </el-upload>
  </el-dialog>
</template>

<script>
  import store from '@/store'
  export default {
    props: ['fromYear','toYear'],
    data(){
      return {
        headers: {
            'Authorization': 'Bearer ' + store.getters.access_token,
        },
        uploadParams:{},
        dialogFormVisible: false,
        fileList: []
      }
    },
    methods:{
      init(){
        this.dialogFormVisible = true
      },
        beforeUpload(file, fileList) {
        this.uploadParams={
            'fromYear':this.fromYear,
            'toYear':this.toYear
        }
      },
      handlePreview(file) {},
      beforeRemove(file, fileList) {
        return this.$confirm(`确定移除 ${ file.name }？`);
      }
    }
  }
</script>

<style>
</style>
